package com.acme.bankapp.domain.account;

import com.acme.bankapp.exceptions.*;

public abstract class AbstractAccount implements Account {
	private int id;
    private double balance;
    private String type;

	public AbstractAccount(final int id, final double amount) throws IllegalArgumentException {
        this.id = id;
        if (amount < 0) {
            throw new IllegalArgumentException("Balance can not be negative");
        }
        setBalance(amount);
	}

    public int getId() {
        return id;
    }

    public double getBalance() {
		return balance;
	}

    public void setBalance(final double balance){
        this.balance = balance;
    }

    public void deposit(final double amount) {
        if (amount < 0) {
            System.out.println("Amount deposit can not be negative");
            return;
        }
        balance += amount;
    }

    public String getType() {
        return type;
    }

    public void setType(final String type) {
        this.type = type;
    }

    public abstract void withdraw(final double amount) throws NoEnoughFundsException;

}
